package com.dayuanit.dy16.ebook.ebookweb.controller;

import com.dayuanit.dy16.ebook.ebookweb.dto.ResponseDTO;
import com.dayuanit.dy16.ebook.ebookweb.exception.BizException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.ExceptionHandler;

public abstract class BaseController {

    @Value("${ebook.picture.path}")
    protected String picturePath;

    protected long getUserId() {
        return 1L;
    }

    @ExceptionHandler(BizException.class)
    public ResponseDTO processBizException(BizException be) {
        be.printStackTrace();
        return ResponseDTO.fail(be.getMessage());
    }
}
